Skip to content

Add skip option to per_file#211

Open
furtib wants to merge 6 commits intoEricsson:mainfrom
furtib:skipfile-for-per-file-python
Open

Add skip option to per_file#211
furtib wants to merge 6 commits intoEricsson:mainfrom
furtib:skipfile-for-per-file-python

Conversation

@furtib
Copy link
Copy Markdown
Contributor

@furtib furtib commented Mar 31, 2026

Why:
There is no skipfile option for the per_file rule.
We should strive to solve this on the Bazel side, but in the meanwhile it is okay if we just create an empty plist file for skipped files.

What:

  • Added skip option for the per_file rule.

Addresses:
Fixes: #160

@furtib furtib requested a review from Szelethus March 31, 2026 11:59
@furtib furtib self-assigned this Mar 31, 2026
@furtib furtib added the enhancement New feature or request label Mar 31, 2026
Copy link
Copy Markdown
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the most correct solution would be to make CodeChecker the single source of authority on how to do skipping. For instance, CodeChecker would-skip mytest.cpp --skip skipfile.txt could return 0/1. On the other hand... this is quite an established interface we are extremely unlikely to ever change.

@bruntib, can you throw in your two cents?

Copy link
Copy Markdown
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had an intersting coversation WRT older CC versions. If we patch this CodeChecker-side, it would be more elegant and robust, and wouldn't need much (any?) bazel side changes. However, that would cement skip files not working for per-file analysis with older CC versions. We should consider this carefully.

Comment thread src/per_file_script.py Outdated
@furtib furtib force-pushed the skipfile-for-per-file-python branch 2 times, most recently from d494901 to 50f5b0c Compare April 7, 2026 13:40
@furtib furtib force-pushed the skipfile-for-per-file-python branch from 50f5b0c to 1bb58db Compare April 7, 2026 13:41
@furtib furtib requested a review from Szelethus April 9, 2026 14:30
@Szelethus Szelethus requested review from nettle and removed request for Szelethus April 9, 2026 14:30
@furtib furtib requested a review from Szelethus April 10, 2026 12:42
Copy link
Copy Markdown
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just please tidy up the code and docs.

Comment thread src/per_file_script.py Outdated
Comment on lines +142 to +147
compiled_analyzers = [
(re.compile(rf"_{analyzer[0]}_.*\.plist$"), analyzer[1])
for analyzer in ANALYZER_PLIST_PATHS
]

for regex, target_file in compiled_analyzers:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I see where you are going with this, but this is a little messy. Neither compiled_analyzers nor regex are terribly talkative. How about leaving the regex compilation in the loop?

Copy link
Copy Markdown
Contributor Author

@furtib furtib May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really prefer to leave the compilation out of the loop.
I do understand that regex compilation is still much faster than compilation, but just for readability dropping so much performance...

I tried to make the variables more talkative. Is this better?

Comment thread src/per_file_script.py
@furtib furtib requested a review from Szelethus May 4, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-file skipfile option missing

2 participants